﻿using System.Linq;
using Microsoft.Xna.Framework;
using SomeGame.Actors.Types;
using SomeGame.Zones;

namespace SomeGame {

    public static class RenderingEngine {

        public static void Update(GameTime gameTime) {
            if (GameEngine.Camera.Mode == CameraMode.Play && GameEngine.Camera.IsFollowingPlayer) {
                GameEngine.Camera.Position = GameEngine.Player.Body.Position;
            }
        }

        public static void Draw() {
            foreach(Actor actor in ZoneManager.CurrentZone.StaticBackgroundActors) {
                actor.Draw(false);
            }
            foreach(Actor actor in ZoneManager.CurrentZone.StaticBackgroundParticles) {
                actor.Draw(false);
            }
            foreach(Actor actor in ZoneManager.CurrentZone.BackgroundActors) {
                actor.Draw(true);
            }
            foreach(Actor actor in ZoneManager.CurrentZone.BackgroundParticles) {
                actor.Draw(true);
            }
            foreach(Actor actor in ZoneManager.CurrentZone.PlayerLevelActors) {
                actor.Draw(true);
            }
            GameEngine.Player.Draw(true);
            foreach(Actor actor in ZoneManager.CurrentZone.ForegroundActors) {
                actor.Draw(true);
            }
            foreach(Actor actor in ZoneManager.CurrentZone.ForegroundParticles) {
                actor.Draw(true);
            }
        }

    }

}